package myMath

import "fmt"

var Hero string = "hello goLong"
var B int = 20

var C string = "你好啊,世界"
var d int

/*func init() {
	d = 20
	fmt.Println("myMath......")
}*/
func Sum(x, y int) (int, int) {
	return x + y, x - y
}

func Chengfa() int {
	var a = 10
	var b = 2
	return a * b
}
func Cal(n1, n2 float64, n3 byte) float64 {
	var res float64
	switch n3 {
	case '+':
		res = n1 + n2
	case '-':
		res = n1 - n2
	case '*':
		res = n1 * n2
	case '/':
		res = n1 / n2
	default:
		fmt.Println("找不到符号")
	}
	return res
}

func Digui(n1 int) int {
	if n1 == 1 {
		return 1
	}
	return n1 * Digui(n1-1)
}

func Peach(n int) int {
	if n > 10 || n < 1 {
		fmt.Println("天数不对")
	}
	if n == 10 {
		return 1
	} else {
		return (Peach(n+1) + 1) * 2
	}
}

func Test01(ptr *int) {
	*ptr = 20

}

func Test02(t1 func(int int) int) int {
	return t1(2)
}

func Test03(n2 int, args ...int) int {
	var res int
	for i := 0; i < len(args); i++ {
		res += args[i]
	}
	return res + n2
}
